package com.itheima.health.listener;

import com.itheima.health.pojo.Setmeal;
import com.itheima.health.service.SetMealService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import java.util.List;

@SuppressWarnings("ALL")
/**
 * @Description :
 * @author     :LD
 */
@Order(0)
@Component
public class HotSetMealInIt implements ApplicationListener<ContextRefreshedEvent> {
    @Reference
    private SetMealService setMealService;

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        List<Setmeal> hot = setMealService.findHot();
        System.out.println("向redis存储热门数据"+hot);
    }
}
